/*!
 * \file nuMacEvent.h
 * \brief Event container for MacOS X.
 * \author Nus
 * \date 2008/03/10, 21:57
 */

#ifndef __NUMACEVENT_H__
#define __NUMACEVENT_H__

#include "Types.h"

//! \brief Max. number of event type.
#define MAC_EVENT_MAX 64

/*!
 * \class nuMacEvent
 * \brief Mac event type.
 */
class nuMacEvent
{
public:
  //! \brief Event.
  class Evt
  {
  public:
    //! \brief Custom constructor.
    Evt(u32 ev_class, u32 ev_kind)
        : EventClass(ev_class),
          EventKind(ev_kind)
    {
      // None...
    }
  
    //! \brief Default destructor.
    ~Evt() {
      // None...
    }
  
    u32 EventClass;                 //!< Event class.
    u32 EventKind;                  //!< Event kind.
    
  protected:
    // None...
  
  private:
    //! \brief Default constructor.
    //! \warning Unused function.
    Evt();
  
  };
  
  //! \brief Default constructor.
  nuMacEvent()
      : mEventNum(0)
  {
    // None...
  }
  
  //! \brief Default destructor.
  ~nuMacEvent() {
    // None...
  }
  
  //! \brief Get event list.
  const EventTypeSpec* getEventList(void) const {
    return mEventList;
  }
  
  //! \brief Get number of event.
  u32 getEventNum(void) const {
    return mEventNum;
  }
  
  //! \brief Get size.
  u32 getSize(void) const {
    return mEventNum * sizeof(EventTypeSpec);
  }
  
  //! \brief Register event.
  nuMacEvent& operator << (const Evt& spec) {
    if(mEventNum < MAC_EVENT_MAX) {
      mEventList[mEventNum].eventClass = spec.EventClass;
      mEventList[mEventNum].eventKind = spec.EventKind;
      mEventNum++;
    }
    return *this;
  }

protected:
  u32 mEventNum;                  //!< Number of events.
  EventTypeSpec mEventList[MAC_EVENT_MAX]; //!< Event list.

private:
  // None...

};

#endif
